package section_02.ClassObject;

import java.util.Random;
import java.util.concurrent.SynchronousQueue;

public class ClassInitialization {

	public static Random rand = new Random(47);

	public static void main(String[] args) throws Exception {
		Class initable = Initable.class;
		System.out.println("After creating Initable ref");
		System.out.println(Initable.staticFinal);
		System.out.println(Initable.staticFinal2);

		System.out.println(Initable2.staticNonFinal);

		Class initable3 = Class.forName("section_02.ClassObject.Initable3");
		System.out.println("After creating Initable3 ref");
		System.out.println(Initable3.staticNonfinal);
	}

}

class Initable {
	static final int staticFinal = 47;
	static final int staticFinal2 = ClassInitialization.rand.nextInt(1000);
	static {
		System.out.println("Initializing Initable");
	}
}

class Initable2 {
	static int staticNonFinal = 147;
	static {
		System.out.println("Initializing Initable2");
	}
}

class Initable3 {
	static int staticNonfinal = 74;
	static {
		System.out.println("Initializing Initable3");
	}
}
